package  com.diamond.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.diamond.bo.SupplierBO;
import com.diamond.facade.SupplierFacade;
import com.opensymphony.xwork2.ActionSupport;

/**
 * SupplierAction ������
 * @author JSmart Tools
 */
public class SupplierAction extends ActionSupport {

	private HttpServletRequest request = ServletActionContext.getRequest();
//	private ISupplierService supplierService;
	private SupplierFacade supplierFacade;
	private SupplierBO supplierBo;
	private List dataList;
	private String tips;
	
	public String doSave() {
		try {
			supplierFacade.save(supplierBo);
			return SUCCESS;
		} catch (Exception e) {
			return ERROR;
		}
	}
 
	public String toUpdate() {
		try {
			supplierBo = (SupplierBO) supplierFacade.findById(request.getParameter("id"));
			return "toUpdate";
		} catch (Exception e) {
			return ERROR;
		}
	}  

	public String doUpdate() {
		try {
			supplierFacade.update(supplierBo);
			return SUCCESS;
		} catch (Exception e) {
			return ERROR;
		}
	}
 	
	public List getDataList() {
		return dataList;
	}

	public void setDataList(List dataList) {
		this.dataList = dataList;
	}
 
	public SupplierBO getSupplierBo() {
		return supplierBo;
	}

	public void setSupplierBo(SupplierBO supplierBo) {
		this.supplierBo = supplierBo;
	}

	public void setSupplierFacade(SupplierFacade supplierFacade) {
		this.supplierFacade = supplierFacade;
	}

	public SupplierBO getSupplier() {
		return supplierBo;
	}

	public void setSupplier(SupplierBO supplierBo) {
		this.supplierBo = supplierBo;
	}
    
	public String getTips() {
		return tips;
	}

	public void setTips(String tips) {
		this.tips = tips;
	}
}
